from django import forms
from django.contrib.comments.forms import CommentForm
from ModuleDeliberation.models import CustomComment
from django.contrib.contenttypes import generic

class CustomCommentForm(CommentForm):
	rating = generic.GenericRelation(Rating)
	votes = generic.GenericRelation(Vote)
	
    def get_comment_model(self):
        return CustomComment

    def get_comment_create_data(self):
        # Use the data of the superclass, and add in the title field
        data = super(CustomCommentForm, self).get_comment_create_data()
        data['rating'] = self.cleaned_data['rating'] #not sure if this works for GenericRelations
        data['votes'] = self.cleaned_data['votes'] #ditto
        return data